class  Animal
{
    public String name;
    public int age;

    public void eat()
    {
        System.out.println(name+"在吃饭");
    }
}
class Dog extends Animal{

    public void eat()
    {
        System.out.println(name+"在狗粮");
    }

    public void wangwang()
    {
        System.out.println(name+"在旺旺");
    }
}

class Brid extends Animal{

    public void eat()
    {
        System.out.println(name+"在鸟粮");
    }

    public void wing(){
        System.out.println(name+"在飞");
    }
}
public class Test {
    public static void main(String[] args) {

        Animal animal=new Dog();//向上转型
        //父类对象的引用指向子类对象
        animal.name="小狗";
        animal.eat();
        System.out.println("============");

        Animal animal1=new Brid();
        animal1.name="小鸟";
        animal1.eat();
    }
}
